package com.yhq.basic.nio;

import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;

/**
 * @author hqyin
 * @date 2024/6/6 2:23 PM
 */
public class TestBuffer {
    public static void main(String[] args) {
        IntBuffer intBuffer = IntBuffer.allocate(10);
        for(int i=1;i<=10;i++) {
            intBuffer.put(i);
        }
        intBuffer.flip();
        while (intBuffer.hasRemaining()){
            System.out.println(intBuffer.get());
        }

        System.out.println(intBuffer.array());
    }
}
